package jmine.tec.report.impl.table.pdf;

import jmine.tec.report.api.table.ReportCell;
import jmine.tec.report.impl.table.RendererParameterInterface;
import jmine.tec.report.impl.table.ReportTableBuilder;
import bancosys.tec.utils.formatter.NumberFormatter;

import com.lowagie.text.Element;

/**
 * @author adalberto.kishi
 */
public class NumberPorcentagemCellPDFRenderer extends NumberCellPDFRenderer {

    /**
     * {@inheritDoc}
     */
    public String getRendererType() {
        return ReportTableBuilder.TYPE_PORCENTAGEM;
    }

    /**
     * {@inheritDoc}
     */
    public String getFormattedString(ReportCell cell) {
    	if (this.getBigDecimalValue(cell) == null) {
    		return "";
    	}
    	
        return NumberFormatter.formatDecimalNumber(this.getBigDecimalValue(cell), this
                .getDecimals(cell))
                + "%";
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected int getHorizontalAlignment(RendererParameterInterface rpi) {
        return Element.ALIGN_RIGHT;
    }

}
